package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseConfig;
import com.briup.recognition.bean.BaseConfigExample;
import com.briup.recognition.dao.BaseConfigMapper;
import com.briup.recognition.service.IBaseConfigService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: 黎海梅
 * @Date: 2021/03/28/17:15
 * @Description:
 */
@Service
public class BaseConfigServiceImpl implements IBaseConfigService{

    @Resource
    private BaseConfigMapper baseConfigMapper;

    @Override
    public List<BaseConfig> query(){
        BaseConfigExample example = new BaseConfigExample();

        return baseConfigMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate (BaseConfig baseConfig){
        if (baseConfig.getId()!=null){
            baseConfigMapper.updateByPrimaryKey(baseConfig);
        }else {
            baseConfigMapper.insert(baseConfig);
        }
    }

    @Override
    public void deleteById(long id){

        baseConfigMapper.deleteByPrimaryKey(id);
    }


}
